class BaseResponse{
    constructor(data,message) {
        if (typeof data === 'string'){
            this.message = data;
            data = null;
            message = null;
        }
        if (data){
            this.data = data;
        }
        if (message){
            this.message = message;
        }
    }
}

class SuccessResponse extends BaseResponse{
    constructor(data,message) {
        super(data,message);
        this.code = 0;
    }
}

class ErrorResponse extends BaseResponse{
    constructor(data,message) {
        super(data,message);
        this.code = -1;
    }
}

module.exports = {
    SuccessResponse,
    ErrorResponse
}